package com.redsoft.spirit.entity;

import java.util.Map;
import org.apache.shiro.authc.AuthenticationToken;

/**
 * 无状态的token实体类.
 * 
 * <pre>
 * 	原本这个实体类是要将前台传过来的数据进行构造成这个结构，然后给shiro的登录认证时候使用的，现在结合了jwt就随意用了。没有发挥实质性意义。
 * </pre>
 * 
 * @author 杨雷
 * @since TODO: 来源版本
 */
public class StatelessToken implements AuthenticationToken {

	private static final long serialVersionUID = 1L;
	private String username;
	private Map<String, ?> params;
	private String clientDigest;

	public StatelessToken(String username, Map<String, ?> params, String clientDigest) {
		this.username = username;
		this.params = params;
		this.clientDigest = clientDigest;
	}

	public String getUsername() {
		return this.username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public Map<String, ?> getParams() {
		return this.params;
	}

	public void setParams(Map<String, ?> params) {
		this.params = params;
	}

	public String getClientDigest() {
		return this.clientDigest;
	}

	public void setClientDigest(String clientDigest) {
		this.clientDigest = clientDigest;
	}

	@Override
	public Object getPrincipal() {
		return this.username;
	}

	@Override
	public Object getCredentials() {
		return this.clientDigest;
	}
}